package com.atlzk.group.tgou.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atlzk.group.tgou.entity.KanshopEntity;
import com.atlzk.group.tgou.service.KanshopService;
import com.atlzk.common.utils.PageUtils;
import com.atlzk.common.utils.R;



/**
 * 
 *
 * @author liuzekun
 * @email 2803587841@gmail.com
 * @date 2021-06-23 22:45:20
 */
@RestController
@RequestMapping("tgou/kanshop")
public class KanshopController {
    @Autowired
    private KanshopService kanshopService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("tgou:kanshop:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = kanshopService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{smsKanshopId}")
    //@RequiresPermissions("tgou:kanshop:info")
    public R info(@PathVariable("smsKanshopId") Long smsKanshopId){
		KanshopEntity kanshop = kanshopService.getById(smsKanshopId);

        return R.ok().put("kanshop", kanshop);
    }

    /**
     * 信息
     */
    @RequestMapping("/ById/{smsKanshopId}")
    //@RequiresPermissions("tgou:kanshop:info")
    public KanshopEntity ById(@PathVariable("smsKanshopId") Long smsKanshopId){
        return kanshopService.getById(smsKanshopId);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("tgou:kanshop:save")
    public R save(@RequestBody KanshopEntity kanshop){
		kanshopService.save(kanshop);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("tgou:kanshop:update")
    public R update(@RequestBody KanshopEntity kanshop){
		kanshopService.updateById(kanshop);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("tgou:kanshop:delete")
    public R delete(@RequestBody Long[] smsKanshopIds){
		kanshopService.removeByIds(Arrays.asList(smsKanshopIds));

        return R.ok();
    }

}
